﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SEVN.Web.Framework.Modules.Menu
{
    public partial class Menu0201 : System.Web.UI.UserControl
    {
        WebFrameDataContext web = new WebFrameDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            RptMenu.DataSource = web.Categories.Where(x => x.CategoryParentID == 0);
            RptMenu.DataBind();
        }
        protected void RptMenu_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            HiddenField hf = (HiddenField)e.Item.FindControl("hf");
            Repeater rptListChildrenMenu = (Repeater)e.Item.FindControl("RptChildrent");
            if (hf != null && rptListChildrenMenu != null)
            {
                rptListChildrenMenu.DataSource = web.Categories.Where(x => x.CategoryParentID.ToString() == hf.Value);
                rptListChildrenMenu.DataBind();
            }
        }
    }
}